package com.yy.xshell.process.resultHandler;

import com.yy.xshell.core.ShellContext;
import com.yy.xshell.process.Handler;

/**
 * @author wxy
 * @version 1.0
 * @date 2024/11/22 15:16
 */
public class ClearHandler extends Handler<ShellContext> {
    @Override
    public ShellContext handler(ShellContext command) {
        String msg = command.getMsg();
        msg = msg.replace("\033[H\033[J", "");
        command.setMsg(msg);
        command.setClear("all");
        return command;
    }

    @Override
    public boolean accept(ShellContext command) {
        return command.getMsg().contains("\033[H\033[J");
    }
}
